<link rel="stylesheet" href="<%- Virtual_Path.Static %>main/css/profile.css"/>
<link rel="stylesheet" href="<%- Virtual_Path.Static %>jquery.plugin/pagination/pagination.css">
<script src="<%- Virtual_Path.Static %>jquery.plugin/pagination/pagination.js"></script>
<div class="anchor-cont">
    <div class="divColorbox_Header" class="xiu-dialog-head">
        <span><i class="fa fa-star"></i><span>公会收入明细</span></span>
        <a class="Refresh"></a><a class="Close"></a>
    </div>
    <div class="tabs-cont">
        <div class="hander-func">
            <p class="fl">
                用户ID：<input name="User_ID" class="qing-input" id="userIds" type="text" placeholder="">
            </p>
            <p class="fl">
                艺人名称：<input name="NickName" class="qing-input" id="nicknames" type="text" placeholder="">
            </p>
            <a class="c-button fl" id="find_family_anchor" href="javascript:;">查询</a>
        </div>

        <div class="tableinfo">
            <table class="tabinfo">
                <thead>
                <tr>
                    <th>艺人ID</th>
                    <th>艺人昵称</th>
                    <th>金豆收入(元)</th>
                </tr>
                </thead>
                <tbody id="J_OrderList">
                <tr>
                    <td colspan="3">加载中...</td>
                </tr>
                </tbody>
            </table>
        </div>
        <div id="AjaxPagination" class="pagination"></div>
    </div>
</div>
<script>
    $(function () {
        var _parm = {
            User_ID: '',
            NickName: ''
        };
        //搜索
        $('#find_family_anchor').on('click', function () {
            var param = {};
            param.User_ID = $.trim($('#userIds').val());
            param.NickName = $.trim($('#nicknames').val());
            if (!param.User_ID && !param.NickName) {
                $.KOC.Tips.Open("Error", '请输入用户名或昵称！', {Timeout: 2000});
                return;
            }
            _parm.User_ID = param.User_ID;
            _parm.NickName=param.NickName;
            AnchorData();
        });
        if (_parm.User_ID == '' &&　_parm.NickName=='') {
            AnchorData();
        }
        function AnchorData() {
            $.ajax({
                url: '/ajaxs/report.anchor-family-month.list',
                type: 'post',
                dataType: 'json',
                data: {
                    User_ID: _parm.User_ID,
                    NickName: _parm.NickName,
                    Report_Day_Start:_PageData.Report_Day,
                    Report_Day_End:_PageData.Report_Day
                },
                success: function (data) {
                    if (data.flag != 0) {
                        $.KOC.Tips.Open("Error", data.msg + "(" + data.flag + ")", {Timeout: 3000});
                        return;
                    }
                    var _html = '';
                    if (data.data.length <= 0) {
                        _html = RenderPage(null, data.data.length);
                        $('#J_OrderList').empty().html(_html);
                        return;
                    }
                    _.forEach(data.data, function (ThisValue) {
                        _html += RenderPage(ThisValue, data.data.length);
                    });
                    $('#J_OrderList').empty().html(_html);
                }
            })
        }
        function RenderPage(ThisValue, len) {
            var _html = '';
            if (len <= 0) {
                _html += '<tr>' +
                        '<td colspan="3">' + '暂无数据！' +
                        '</td>' +
                        '</tr>';
            } else {
                _html += '<tr>' +
                        '<td>' + ThisValue.User_ID +
                        '</td>' +
                        '<td>' + ThisValue.NickName +
                        '</td>' +
                        '<td>' + ThisValue.Beans_Anchor_Task/1000 +
                        '</td>' +
                        '</tr>';
            }
            return _html;
        }
    })
</script>